var parts = ["Hello"];

if (arguments.length === 0) {
    parts.push("World");
}
else if (arguments.length === 1) {
    parts.push(arguments[0]);
}
else {
    parts = parts.concat(arguments.slice(0, arguments.length-1));
    parts.push("and " + arguments.pop());
}

print(parts.join(", ") + "!");
